package com.wxh.order;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author wxh
 */
@SpringBootApplication
@EnableEurekaClient   // 启用eureka
@EnableFeignClients   // 启用feign
@EnableCircuitBreaker // 启用熔断
@EnableTurbine        // 启用turbine监控
// @RibbonClient(value = "PROVIDER-USER", configuration = RibbonConfig.class) // 启用ribbon负载均衡，默认是轮询的随机的算法
public class OrderRibbonApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderRibbonApplication.class, args);
    }

    /**
     * 注解实例化
     *
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
